import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Vector;


public class Test2 
{
	public static void main(String[]args)
	{
		//daca afisare este 1 se va afisa valoarea aferenta fiecarei inregistrari din 6 in 6 secunde/zi
		//daca afisarea este 0 se va afisa doar consumul calculat pe intreaga zi
		
		Tabel2 tabel=new Tabel2();
		
	
		int afisare=0;
		float consumLuna=0;
		Vector<HashMap<String,Integer>> vector = new Vector<HashMap<String,Integer>>();
		
		//alegerea lunii
		String l="",linie2;
		BufferedReader r2=new BufferedReader(new InputStreamReader(System.in));
		System.out.println("Introduceti luna pentru care doriti sa aflati consumul: ");
		try{
			if ((linie2 = r2.readLine()) != null)
			{
				l=linie2;
			}
		}
		catch(IOException e	){}
		//terminare citire luna
		
		DataLuna d=new DataLuna();
		int n=d.lunaNrZile(l);
		
		
		
		
		
		for(int i=0;i<n;i++)
		{
			
			HashMap<String,Integer> t=tabel.GenerareHashMap();
			vector.add(i,t);//adauga un element-hash map in vector
			
			float suma=tabel.calculateDay(vector.elementAt(i),afisare);//calcularea consumului pe zi
			consumLuna=consumLuna+suma;//consumul lunar
			int j=i+1;
			System.out.println("Consumul pe ziua "+j+" este de "+suma+" kW");
			
			
		}
		System.out.println("Consumul lunar este de: "+consumLuna+" kW");
				
		Categorii cat= new Categorii();
		//citire categorie
		String l2="",linie3;
		BufferedReader r3=new BufferedReader(new InputStreamReader(System.in));
		System.out.println("Introduceti categoria pentru efectuarea facturii(CS,CD,CR,CR2,CR3,CTP,CI,CP,CP2,CP3): ");
		try{
			if ((linie3 = r3.readLine()) != null)
			{
				l2=linie3;
			}
		}
		catch(IOException e	){}
		//var pt functii de categorii
		float En=0;
		float Ev=0;
		float Eg=0;
		
		if(l2.equals("CS")) cat.calculateCS(consumLuna, n);
		if(l2.equals("CD")) cat.calculateCD(consumLuna);
		if(l2.equals("CR")) cat.calculateCR(consumLuna, n);
		if(l2.equals("CR2")) cat.calculateCR2(consumLuna,En, n);
		if(l2.equals("CR3")) cat.calculateCR3(consumLuna,Ev,En,Eg, n);//void calculateCR3(float E,float Ev,float En, float Eg, int N)
		if(l2.equals("CTP")) cat.calculateCTP(consumLuna, n);
		if(l2.equals("CI")) cat.calculateCI(consumLuna, n);
		if(l2.equals("CP")) cat.calculateCP(consumLuna, n);
		if(l2.equals("CP2")) cat.calculateCP2(consumLuna,En, n);
		if(l2.equals("CP3")) cat.calculateCP3(consumLuna,En,Ev,Eg, n);//void calculateCP3(float E,float En,float Ev,float Eg, int N)
		
		 
		
		

		
		//tabel.afisareHashMap(t);
		
		/*
		String q1="",q2="",linie;
		BufferedReader r=new BufferedReader(new InputStreamReader(System.in));
		System.out.println("Introduceti ora dupa formatul 'hh:mm:ss' din 6 in 6 secunde!");
		System.out.println("Introduceti prima ora: ");
		try{
			if ((linie = r.readLine()) != null)
			{
				q1=linie;
			}
		}
		catch(IOException e	){}

		System.out.println("Introduceti a doua ora: ");
		try{
			if ((linie = r.readLine()) != null)
			{
				q2=linie;
			}
		}//try
		catch(IOException e	){}
		System.out.println("Incepe afisarea: ");
	
		
		tabel.afisareTimpiInterval(q1,q2);
		//tabel.afisareTimpiCuValoriInterval(t, q1, q2);
		
		
		*/
		
	}//main
	
}//Test2
